package assig2;

import java.util.Date;

public class Sketch extends Drawing{
	protected Person artist;
	
	
	/**
	 * @return the artist
	 */
	public Person getArtist() {
		return artist;
	}

	/**
	 * @param artist the artist to set
	 */
	public void setArtist(Person artist) {
		this.artist = artist;
	}

	/** Default constructor
	 * 
	 */
	Sketch () {
		// Note: Default constructor of parent is invoked automatically
		artist = null;
	}
	
	/** A more complete constructor!
	 * @param creationDate
	 * @param ownerName 
	 * @param ownerId
	 * @param height Vertical dimension in inches
	 * @param width Horizontal dimesnion in inches
	 */
	Sketch(Date creationDate, String ownerName, long ownerId,
			double height, double width, Person artistPerson) {
		// Instead of the default constructor, explicitly invoke 
		// the parent constructor with proper parameters
		super(creationDate, ownerName, ownerId, height, width);
		this.artist = artistPerson;
	}
	
	/**
	 * @return String version of the object
	 */
	public String toString() {
		String s = ""; // Return string to construct;
		// s = super.toString(); // Invoke toString() of parent class

		// First handle the owner, if any
		if (this.getOwner() == null) {
			s = "No owner ";
		} else {
			s = "Owner: " + this.getOwner() + " ";
		}
		
		// Then add the creaton date
		s = s + "Creation date: " + this.getCreationDate();
		// Handle the artist, if any
		if (this.artist == null) {
			s = s + " by anonymous ";
		} else {
			s = s + " by: " + this.artist;
		}
		return s;
	}
		
}
